package service;

import common.CommException;
import dao.LoginDao;
import domain.User;

public class LoginServise {
     LoginDao logindao = new LoginDao();
	public User login(User user) {
		User user2 = logindao.findlogin(user.getUsercode());
		   if(user2==null) {
			   throw new CommException("不存在该用户");
		   }
		   if(user2.getPasswords()!=user.getPasswords()) {
			   throw new CommException("密码错误");
		   }
		
		return user2;
	}

}
